package socketmvc.spring.support.context;

import org.tio.core.TioConfig;
import org.tio.utils.lock.ListWithLock;
import socketmvc.core.config.SocketMvcConfig;
import socketmvc.core.lambda.DoubleValConsumer;
import socketmvc.core.packets.basic.IPacket;
import socketmvc.server.SocketServerStarter;
import socketmvc.server.context.IChannelContext;
import socketmvc.server.context.IServerContext;

import java.util.List;


public class SocketServerContextSpringWrapper implements IServerContext {

    protected IServerContext target;

    public SocketServerContextSpringWrapper() {}

    public void setTarget(IServerContext target) {
        this.target = target;
    }

    @Override
    public Object getAttr(String key) {
        return target.getAttr(key);
    }

    @Override
    public Object setAttr(String key, Object val) {
        return target.setAttr(key,val);
    }

    @Override
    public SocketServerStarter getServer() {
        return target.getServer();
    }

    @Override
    public TioConfig getIoConfig() {
        return target.getIoConfig();
    }

    @Override
    public SocketMvcConfig getMvcConfig() {
        return target.getMvcConfig();
    }

    @Override
    public List<IChannelContext> getByUser(String user) {
        return target.getByUser(user);
    }

    @Override
    public ListWithLock<IChannelContext> getByUserWithLock(String user) {
        return target.getByUserWithLock(user);
    }

    @Override
    public List<IChannelContext> getByGroup(String group) {
        return target.getByGroup(group);
    }

    @Override
    public ListWithLock<IChannelContext> getByGroupWithLock(String group) {
        return target.getByGroupWithLock(group);
    }

    @Override
    public IChannelContext getByCurrentThread() {
        return target.getByCurrentThread();
    }

    @Override
    public void send(ListWithLock<IChannelContext> contexts, IPacket packet) {
        target.send(contexts,packet);
    }

    @Override
    public void send(List<IChannelContext> contexts, IPacket packet) {
        target.send(contexts,packet);
    }

    @Override
    public void send(IChannelContext context, IPacket packet) {
        target.send(context,packet);
    }

    @Override
    public void sendToUser(String user, IPacket packet) {
        target.sendToUser(user,packet);
    }

    @Override
    public void sendToUserNullable(String user, IPacket packet, DoubleValConsumer<String, IPacket> nullableCall) {
        target.sendToUserNullable(user,packet,nullableCall);
    }

    @Override
    public void sendToGroup(String group, IPacket packet) {
        target.sendToGroup(group,packet);
    }

    @Override
    public void sendToGroupNullable(String group, IPacket packet, DoubleValConsumer<String, IPacket> nullableCall) {
        target.sendToGroupNullable(group,packet,nullableCall);
    }

    @Override
    public void sendToCurrentThread(IPacket packet) {
        target.sendToCurrentThread(packet);
    }

    @Override
    public void bindUser(IChannelContext context, String user) {
        target.bindUser(context,user);
    }

    @Override
    public void bindGroup(IChannelContext context, String group) {
        target.bindGroup(context,group);
    }

    @Override
    public void unbindUser(IChannelContext context, String user) {
        target.unbindUser(context,user);
    }

    @Override
    public void unbindUser(String user) {
        target.unbindUser(user);
    }

    @Override
    public void unbindGroup(IChannelContext context, String group) {
        target.unbindGroup(context,group);
    }

    @Override
    public void unbindGroup(String user, String group) {
        target.unbindGroup(user, group);
    }

    @Override
    public boolean getUserIsOnline(String user) {
        return target.getUserIsOnline(user);
    }

    @Override
    public void close(IChannelContext context) {
        target.close(context);
    }

    @Override
    public void close(List<IChannelContext> contexts) {
        target.close(contexts);
    }

    @Override
    public void close(ListWithLock<IChannelContext> contexts) {
        target.close(contexts);
    }

    @Override
    public void setContextToBlacklist(IChannelContext context) {
        target.setContextToBlacklist(context);
    }

    @Override
    public void delContextFromBlacklist(IChannelContext context) {
        target.delContextFromBlacklist(context);
    }

    @Override
    public boolean isContextInBlacklist(IChannelContext context) {
        return target.isContextInBlacklist(context);
    }
}
